﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Util.XamariN.Essentials
{
    public class DisplayInfo
    {
        public DisplayInfo()
        {
            var metrics = Xamarin.Essentials.DeviceDisplay.MainDisplayInfo;

            //// Orientation (Landscape, Portrait, Square, Unknown)
            //var orientation = metrics.Orientation;

            //// Rotation (0, 90, 180, 270)
            //var rotation = metrics.Rotation;

            //// Width (in pixels)
            //var width = metrics.Width;

            //// Height (in pixels)
            //var height = metrics.Height;

            //// Screen density
            //var density = metrics.Density;

            Orientation = metrics.Orientation.ToString();
            RotationInfo = metrics.Rotation.ToString();
            Rotation = int.Parse(metrics.Rotation.ToString().ToUpper().Replace("ROTATION", ""));
            Width = metrics.Width;
            Height = metrics.Height;
            Density = metrics.Density;
        }

        /// <summary>
        /// Orientation (Landscape, Portrait, Square, Unknown)
        /// </summary>
        public string Orientation { get; set; }

        public string RotationInfo { get; set; }

        /// <summary>
        /// Rotation (0, 90, 180, 270)
        /// </summary>
        public int Rotation { get; set; }

        public double Width { get; set; }

        public double Height { get; set; }

        /// <summary>
        /// 密度
        /// </summary>
        public double Density { get; set; }


    }
}
